﻿using System;
using System.ComponentModel.DataAnnotations;

namespace Noodles.Core.Model
{
    [AttributeUsage(AttributeTargets.Property)]
    public class EnforcedStringLengthAttribute : StringLengthAttribute
    {
        public EnforcedStringLengthAttribute(int maximumLength)
            : base(maximumLength)
        {
        }

        public override bool IsValid(object value)
        {
            var enforcedString = (EnforcedString)value;

            return base.IsValid(enforcedString.ToString());
        }
    }
}
